package com.sgb.contract.view.ui.openaccount;

import androidx.lifecycle.MutableLiveData;

import com.sgb.contract.api.AbstractCallBack;
import com.sgb.contract.api.ContractNet;
import com.sgb.contract.base.viewmodel.BaseViewModel;
import com.swgk.core.base.model.entity.BaseEntity;

import java.util.Map;

/**
 * 描述：修改经办人
 *
 * @author qiangHeNooo
 * <p>
 * 时间：2021.11.02
 */
public class AccountEditModel extends BaseViewModel {

    public MutableLiveData<Integer> validateCode = new MutableLiveData<>();
    public MutableLiveData<Integer> accountEditCode = new MutableLiveData<>();


    public void getValidateCode(String tel) {
        showLoading();
        ContractNet.getInstance().getContractApi().getValidateCode(tel, true).enqueue(new AbstractCallBack<BaseEntity<Object>>() {
            @Override
            public void onSuccess(BaseEntity<Object> data) {
                validateCode.postValue(1);
            }
        });
    }

    public void updateAccount(Map<String, Object> map) {
        showLoading();
        ContractNet.getInstance().getContractApi().updateAccount(map).enqueue(new AbstractCallBack<BaseEntity<Object>>() {
            @Override
            public void onSuccess(BaseEntity<Object> data) {
                accountEditCode.postValue(1);
            }
        });
    }
}
